package com.example.cofeed.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.cofeed.R;
import com.example.cofeed.entity.City;

/**
 * Created by mqwang on 2017/11/18.
 */

public class SubscriptionCityListAdapter extends BaseQuickAdapter<City, BaseViewHolder> {
    public SubscriptionCityListAdapter() {
        super(R.layout.item_subscription_city_list);
    }

    @Override
    protected void convert(BaseViewHolder helper, City item) {

        helper.setText(R.id.city_name_tv, item.city);
        helper.setText(R.id.subscription_time_tv, item.startdate + "\n" + item.enddate);

        if (item.ispush == 1){
            helper.setImageResource(R.id.select_iv, R.mipmap.seltok);
        } else{
            helper.setImageResource(R.id.select_iv, R.mipmap.seltno);
        }

    }

    public void setSelect(City select){
        if (select.ispush == 0) {
            select.ispush = 1;
        } else {
            select.ispush = 0;
        }
        notifyDataSetChanged();
    }

}
